package cocom.iplatform.piaoerbai.service.impl;

import cocom.iplatform.piaoerbai.bean.MenuBean;
import cocom.iplatform.piaoerbai.dao.MenuDao;
import cocom.iplatform.piaoerbai.service.MenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @className: MenuServiceImpl
 * @description: TODO 类描述
 * @author: chensk
 * @date: 2020/12/3
 **/
@Service
public class MenuServiceImpl implements MenuService {
    @Resource
    private MenuDao menuDao;
    @Override
    public List<MenuBean> selectAllMenu() {
        return menuDao.selectAllMenu();
    }

    @Override
    public List<MenuBean> selectChildByParentId(int parentId) {
        return menuDao.selectChildByParentId(parentId);
    }

    @Override
    public int insertOrUpdate(MenuBean menuBean) {
        if(menuBean.getId()==null){
           return menuDao.insert(menuBean);
        }else{
            return menuDao.update(menuBean);
        }
    }

    @Override
    public void deleteById(Integer id) {
        menuDao.deleteById(id);
    }
}
